package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.UniversityMajorScoreMapper;
import com.ruoyi.system.domain.UniversityMajorScore;
import com.ruoyi.system.service.IUniversityMajorScoreService;

/**
 * 大学专业分数线 服务层实现
 * 
 * @author ruoyi
 */
@Service
public class UniversityMajorScoreServiceImpl implements IUniversityMajorScoreService
{
    @Autowired
    private UniversityMajorScoreMapper universityMajorScoreMapper;

    /**
     * 查询大学专业分数线列表
     * 
     * @param universityMajorScore 大学专业分数线信息
     * @return 大学专业分数线集合
     */
    @Override
    public List<UniversityMajorScore> selectUniversityMajorScoreList(UniversityMajorScore universityMajorScore)
    {
        return universityMajorScoreMapper.selectUniversityMajorScoreList(universityMajorScore);
    }

    /**
     * 查询所有大学专业分数线
     * 
     * @return 大学专业分数线列表
     */
    @Override
    public List<UniversityMajorScore> selectUniversityMajorScoreAll()
    {
        return universityMajorScoreMapper.selectUniversityMajorScoreAll();
    }

    /**
     * 通过分数线ID查询大学专业分数线信息
     * 
     * @param id 分数线ID
     * @return 大学专业分数线对象信息
     */
    @Override
    public UniversityMajorScore selectUniversityMajorScoreById(Long id)
    {
        return universityMajorScoreMapper.selectUniversityMajorScoreById(id);
    }

    /**
     * 通过大学专业关联ID查询分数线列表
     * 
     * @param universityMajorId 大学专业关联ID
     * @return 分数线列表
     */
    @Override
    public List<UniversityMajorScore> selectScoresByUniversityMajorId(Long universityMajorId)
    {
        return universityMajorScoreMapper.selectScoresByUniversityMajorId(universityMajorId);
    }

    /**
     * 通过年份和省份查询分数线列表
     * 
     * @param enrollYear 招生年份
     * @param province 省份
     * @return 分数线列表
     */
    @Override
    public List<UniversityMajorScore> selectScoresByYearAndProvince(Integer enrollYear, String province)
    {
        return universityMajorScoreMapper.selectScoresByYearAndProvince(enrollYear, province);
    }

    /**
     * 校验大学专业分数线是否唯一
     * 
     * @param universityMajorScore 大学专业分数线信息
     * @return 结果
     */
    @Override
    public boolean checkUniversityMajorScoreUnique(UniversityMajorScore universityMajorScore)
    {
        Long id = StringUtils.isNull(universityMajorScore.getId()) ? -1L : universityMajorScore.getId();
        UniversityMajorScore info = universityMajorScoreMapper.checkUniversityMajorScoreUnique(universityMajorScore);
        if (StringUtils.isNotNull(info) && info.getId().longValue() != id.longValue())
        {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }

    /**
     * 新增保存大学专业分数线信息
     * 
     * @param universityMajorScore 大学专业分数线信息
     * @return 结果
     */
    @Override
    public int insertUniversityMajorScore(UniversityMajorScore universityMajorScore)
    {
        return universityMajorScoreMapper.insertUniversityMajorScore(universityMajorScore);
    }

    /**
     * 修改保存大学专业分数线信息
     * 
     * @param universityMajorScore 大学专业分数线信息
     * @return 结果
     */
    @Override
    public int updateUniversityMajorScore(UniversityMajorScore universityMajorScore)
    {
        return universityMajorScoreMapper.updateUniversityMajorScore(universityMajorScore);
    }

    /**
     * 删除大学专业分数线信息
     * 
     * @param id 分数线ID
     * @return 结果
     */
    @Override
    public int deleteUniversityMajorScoreById(Long id)
    {
        return universityMajorScoreMapper.deleteUniversityMajorScoreById(id);
    }

    /**
     * 批量删除大学专业分数线信息
     * 
     * @param ids 需要删除的分数线ID
     * @return 结果
     */
    @Override
    public int deleteUniversityMajorScoreByIds(Long[] ids)
    {
        return universityMajorScoreMapper.deleteUniversityMajorScoreByIds(ids);
    }
} 